package com.ry;

import com.ry.util.timepick.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class CitySelectActivity extends Activity {
	private Button btnBack;
	private TextView txt0;
	private TextView txt1;
	private TextView txt2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.city_select);
		init();
	}

	private void init() {
		btnBack = (Button) findViewById(R.city_select.btn_back);
		txt0 = (TextView) findViewById(R.city_select.txt_0);
		txt1 = (TextView) findViewById(R.city_select.txt_1);
		txt2 = (TextView) findViewById(R.city_select.txt_2);

		btnBack.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CitySelectActivity.this.finish();
			}
		});

		txt0.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(CitySelectActivity.this, CityAndModelActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				intent.putExtra("city", "北京");
				setResult(RESULT_OK, intent);
				CitySelectActivity.this.finish();
			}
		});

		txt1.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(CitySelectActivity.this, CityAndModelActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				intent.putExtra("city", "西安");
				setResult(RESULT_OK, intent);
				CitySelectActivity.this.finish();
			}
		});

		txt2.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(CitySelectActivity.this, CityAndModelActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				intent.putExtra("city", "沈阳");
				setResult(RESULT_OK, intent);
				CitySelectActivity.this.finish();
			}
		});
	}
}
